package main

import (
	"fmt"
	simple_sql "gitee.com/jn-qq/go-tools/sql"
	_ "github.com/go-sql-driver/mysql"
)

func main() {
	client, _ := simple_sql.NewDbClient("mysql", "root:MYSQL1.t!@#@tcp(172.31.205.27:3306)/ngkm?charset=utf8mb4&parseTime=True&loc=Local")
	defer client.Close()
	a := client.QueryTable("t_km_tmplt_keys").
		Select("atom_id", "para_nm", "para_type_cd").
		Where(simple_sql.Eq{Filed: "para_type_cd", Value: 6}).OrderBy("-atom_id").Pox(3, 0).String()
	fmt.Println(a)

	type ss struct {
		AtomId   int    `db:"atom_id"`
		ParaNm   string `db:"para_nm"`
		ParaType string `db:"para_type_cd"`
	}
	var cc = new(ss)
	err := client.First(cc)
	if err != nil {
		panic(err)
	}
	fmt.Println(cc)
}
